<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('应加应扣数据')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: container-css"/>
    <th:block th:include="include :: select2-css"/>
</head>

<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form">
                    <input type="hidden" id="ComPidorDepTid" name="ComPidorDepTid">
                    <div class="select-list">
                        <ul>
                            <li>
                                员工编号：<input type="text" name="badge"/>
                            </li>
                            <li>
                                姓名：<input type="text" name="name"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped" id="yjyk">
                <div class="btn-group-sm" role="group">
                    <a class="btn btn-info" onclick="$.table.importExcel()"
                       shiro:hasPermission="system:empSalaryCalculation:import">
                        <i class="fa fa-upload"></i> 导入
                    </a>
                    <button type="button" onclick="chekDate()" class="btn btn-danger btn-sm">导出</button>
                    <button type="button" id="dcykyj" onclick="$.operate.downloadTemplateSalary('yjyk',pgid)"
                            class="btn btn-danger btn-sm">下载应加应扣模板
                    </button>

                </div>
                <table id="addreduce-table" data-mobile-responsive="true"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">
    var prefix = ctx + "salaryCalculation";
    $(function () {
        pgid = [[${pgid}]];
        addreduceList();
    });

    function addreduceList() {
        var columns = [];
        var badge = {field: 'badge', title: '员工编号'};
        var name = {field: 'name', title: '姓名'};
        var compName = {field: '公司名称', title: '公司名称'};
        var depName = {field: '部门名称', title: '部门名称'};
        var jobName = {field: '岗位名称', title: '岗位名称'};
        var EmpStartDate = {field: 'EmpStartDate', title: '入职日期'};
        var StartDate = {field: 'StartDate', title: '起薪日期'};

        columns.push(badge, name, compName, depName, jobName, EmpStartDate, StartDate);
        var other;
        $.ajax({
            async: false,
            url: ctx + "salaryCalculation/getProYJYK",
            data: {"pgid": pgid},
            type: "post",
            dataType: "json",
            success: function (data) {
                for (var i = 0; i < data.length; i++) {
                    other = {field: data[i], title: data[i]}
                    columns.push(other);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
        var options = {
            id: "addreduce-table",
            code: "eid",
            uniqueId: "eid",
            url: prefix + "/getaddreduce?pgid=" + pgid,
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove/{id}",
            importUrl: prefix + "/importData?pgid=" + pgid + "&type=yjyk",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            pagination: false,
            showColumns: false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            height: $(window).height() - 120,
            modalName: "基本信息",
            columns: columns
        };
        $.table.init(options);
    }

</script>

</body>

<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                &nbsp; <a onclick="$.operate.importTemplateSalary('kq')" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i>下载考勤模板</a>
                &nbsp; <a onclick="$.operate.importTemplateSalary('yjyk')" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i>下载应加应扣模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>

</html>